jQuery(document).ready(function() {
	
	//创建JQGRID表格
	var grid = $("#table1").ligerGrid({
        columns: [
                  { display: '单据类型', name: 'billType', width: 150 ,render :function(row){
                	  if(row.billType == 'OC'){
              			return '其他入库';
              		}else if(row.billType == 'QC'){
              			return '其他出库';
              		}else if(row.billType == 'WC'){
              			return '领料出库';
              		}else if(row.billType == 'WT'){
              			return '领料退料';
              		}else if(row.billType == 'ST'){
              			return '调拨发起';
              		}else if(row.billType == 'RC'){
              			return '调拨接收';
              		}else if(row.billType == 'CR'){
              			return '采购入库';
              		}else if(row.billType == 'CT'){
              			return '采购退货';
              		}else if(row.billType == 'PB'){
              			return '库存盘点';
              		}
                  }},
                  { display: '单据编码', name: 'billCode', width: 150 },
                  { display: '所属区域', name: 'area', width: 150 },
                  { display: '物料类型', name: 'maType', width: 150 },
                  { display: '物料编号', name: 'code', width: 150 },
                  { display: '物料名称', name: 'name', width: 100},
                  { display: '型号', name: 'spec', width: 120},
                  { display: '单位', name: 'unit', width: 100 },
                  { display: '仓库', name: 'whName', width: 150},
                  { display: '仓位', name: 'hubName', width: 150},
                  { display: '维修组', name: 'maintenanceGroup', width: 150},
                  { display: '物品状态', name: 'status', width: 100 ,render:function(row){
                	  if(row.status == '1'){
                		  return '一等';
                	  }else if(row.status == '2'){
                		  return '次品';
                	  }else if(row.status == '3'){
                		  return '旧品';
                	  }
                  }},
                  { display: '数量', name: 'quantity', width: 100 ,render:function(row){
                	  
                	  if(row.quantity == null || row.quantity == ''){
                		  return '0.0';
                	  }
                	  return (row.quantity).toFixed(2);
                  }},
                  { display: '金额', name: 'xxx', width: 100 ,render:function(row){
                	  var quan = 0;
                	  if(row.quantity == null || row.quantity == ''){
                		  row.quantity =  0.0;
                	  }
                	  if (row.price == null || row.price == ''){
                		  row.price = 0.0;
                	  }
                	  return (row.quantity*row.price).toFixed(2);
                  }},
                  { display: '建单时间', name: 'dctime', width: 100 ,render: function (item){
            		  var cdate=new Date(item.dctime);
            		  return formatDate(cdate,"yyyy-MM-dd");
            	  }}
                  ],  usePager: true,pageSize:30,
                      url : basic_Url+"/list.do",
                      width: '100%', height: '98%', checkbox: false,rownumbers:true
                  });
	$("#pageloading").hide();
	
	
});
